package com.lh_travel.lohas.activity.user;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

import com.lh_travel.lohas.R;
import com.lh_travel.lohas.base.api;
import com.lh_travel.lohas.base.baseActivity;
import com.lh_travel.lohas.domain.Comment;
import com.tamic.novate.Throwable;
import com.tamic.novate.callback.RxResultCallback;

public class DestActivity extends baseActivity {

    private Toolbar toolbar;
    private ImageButton img_back;
    private TextView tv_content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dest);

        findView();
        bindListner();
        ensureUI();
    }

    @Override
    public void findView() {
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        img_back = (ImageButton) findViewById(R.id.img_back);
        tv_content = (TextView) findViewById(R.id.tv_content);
    }

    @Override
    public void bindListner() {
        img_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    public void ensureUI() {

        setSupportActionBar(toolbar);
        toolbar.setEnabled(true);

        new api(mContext).getBaseInfo("1", new RxResultCallback<Comment>() {
            @Override
            public void onNext(Object tag, int code, String message, Comment response) {

                tv_content.setText(response.content);

            }

            @Override
            public void onError(Object tag, Throwable e) {

            }

            @Override
            public void onCancel(Object tag, Throwable e) {

            }
        });
    }
}
